﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace StorageInterface.Reports
{
    /// <summary>
    /// Interaction logic for RemainsOnStorage.xaml
    /// </summary>
    public partial class RemainsOnStorage : UserControl
    {
        public RemainsOnStorage()
        {
            InitializeComponent();
            Update();
        }

        public void Update()
        {
            var els = Data.GetAllProducts();
            comboproduct.Items.Clear();
            comboproduct.Items.Add("Все товары");
            foreach (var el in els)
                comboproduct.Items.Add(el);
            combostorage.Items.Clear();
            combostorage.Items.Add("Все склады");
            var les = Data.GetAllStorages();
            foreach (var el in les)
                combostorage.Items.Add(el);
            combostorage.SelectedIndex = 0;
            comboproduct.SelectedIndex = 0;
        }


        private void button1_Click(object sender, RoutedEventArgs e)
        {
            bool? b = null;
            if (nullcombo.SelectedIndex == 0)
                b = null;
            else if (nullcombo.SelectedIndex == 1)
                b = true;
            else
                b = false;
            dg.ItemsSource = Data.GetPrInStrs(combostorage.SelectedItem as Storage, comboproduct.SelectedItem as Product, b);
        }
    }
}
